<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="ot" uri="http://www.ideyatech.com/tides"%>
<%@ taglib prefix="idy" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<idy:bs-iris-header title_webpage="title.registration">
	<link rel="stylesheet" type="text/css" href="${url_style}/iris-registration.css" />
</idy:bs-iris-header>

<div class="page-body">
	<div class="form-box-title"><h4>Please review your details</h4></div>
	<hr/>
	<table>
		<tr class="dynamic-field">
			<td class="table-title"><h5>Basic Information</h5></td>
			<td></td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-label"><span>First Name</span></td>
			<td>${patient.firstName}<c:if test="${empty patient.firstName}"><span class="muted">Not specified</span></c:if></td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-label"><span>Last Name</span></td>
			<td>${patient.lastName}<c:if test="${empty patient.lastName}"><span class="muted">Not specified</span></c:if></td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-label"><span>Middle Name</span></td>
			<td>${patient.middleName}<c:if test="${empty patient.middleName}"><span class="muted">Not specified</span></c:if></td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-label"><span>Nickname</span></td>
			<td>${patient.nickname}<c:if test="${empty patient.nickname}"><span class="muted">Not specified</span></c:if></td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-label"><span>Gender</span></td>
			<td>${patient.gender.value}<c:if test="${empty patient.gender}"><span class="muted">Not specified</span></c:if></td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-label"><span>Birth Date</span></td>
			<td><fmt:formatDate value='${patient.birthdate}' pattern="MMMM dd yyyy"/><c:if test="${empty patient.birthdate}"><span class="muted">Not specified</span></c:if></td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-label"><span>Home Address</span></td>
			<td>${patient.address}<c:if test="${empty patient.address}"><span class="muted">Not specified</span></c:if></td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-label"><span>Email Address</span></td>
			<td>${patient.emailAddress}<c:if test="${empty patient.emailAddress}"><span class="muted">Not specified</span></c:if></td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-title"><h5>Contact Details</h5></td>
			<td></td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-label"><span>Mobile</span></td>
			<td>
				<c:set var="mobileSize" value="${fn:length(patient.mobileNumbers)}"/>
				<c:forEach items="${patient.mobileNumbers}" var="mobile" varStatus="status">
					<c:if test="${not mobile.isDeleted}">
						${mobile.number}
					</c:if>
					<c:if test="${status.index < mobileSize-1}">, </c:if>
				</c:forEach>
				<c:if test="${empty patient.mobileNumbers}"><span class="muted">None</span></c:if>
			</td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-label"><span>Landline</span></td>
			<td>
				<c:set var="landlineSize" value="${fn:length(patient.landlineNumbers)}"/>
				<c:forEach items="${patient.landlineNumbers}" var="landline" varStatus="status">
					<c:if test="${not landline.isDeleted}">
						${landline.number}
					</c:if>
					<c:if test="${status.index < landlineSize-1}">, </c:if>
				</c:forEach>
				<c:if test="${empty patient.landlineNumbers}"><span class="muted">None</span></c:if>
			</td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-title"><h5>Allergies</h5></td>
			<td></td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-label"><span>Active</span></td>
			<td>
				<c:set var="activeAllergiesSize" value="${fn:length(patient.activeAllergies)}"/>
				<c:forEach items="${patient.activeAllergies}" var="patientAllergy" varStatus="status">
					<c:if test="${not patientAllergy.isDeleted}">
					${patientAllergy.allergen.name}
					</c:if>
					<c:if test="${status.index < activeAllergiesSize-1}">, </c:if>
				</c:forEach>
				<c:if test="${empty patient.activeAllergies}"><span class="muted">None</span></c:if>
			</td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-label"><span>Inactive</span></td>
			<td>
				<c:set var="inactiveAllergiesSize" value="${fn:length(patient.inactiveAllergies)}"/>
				<c:forEach items="${patient.inactiveAllergies}" var="patientAllergy" varStatus="status">
					<c:if test="${not patientAllergy.isDeleted}">
					${patientAllergy.allergen.name}
					</c:if>
					<c:if test="${status.index < inactiveAllergiesSize-1}">, </c:if>
				</c:forEach>
				<c:if test="${empty patient.inactiveAllergies}"><span class="muted">None</span></c:if>
			</td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-title"><h5>Diseases</h5></td>
			<td></td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-label"><span>Present</span></td>
			<td>
				<c:set var="presentDiseasesSize" value="${fn:length(patient.presentDiseases)}"/>
				<c:forEach items="${patient.presentDiseases}" var="patientDisease" varStatus="status">
					${patientDisease.disease.name}<c:if test="${status.index < presentDiseasesSize-1}">, </c:if>
				</c:forEach>
				<c:if test="${empty patient.presentDiseases}"><span class="muted">None</span></c:if>
			</td>
		</tr>
		<tr class="dynamic-field">
			<td class="table-label"><span>Past</span></td>
			<td>
				<c:set var="pastDiseasesSize" value="${fn:length(patient.pastDiseases)}"/>
				<c:forEach items="${patient.pastDiseases}" var="patientDisease" varStatus="status">
					${patientDisease.disease.name}<c:if test="${status.index < pastDiseasesSize-1}">, </c:if>
				</c:forEach>
				<c:if test="${empty patient.pastDiseases}"><span class="muted">None</span></c:if>
			</td>
		</tr>
	</table>
	
	<form:form method="POST" commandName="patient" cssClass="form-horizontal">
		<div class="control-group">
			<div class="controls">
				<input type="submit" class="btn btn-primary" value="Finish" name="_finish" />
				<input type="submit" class="btn" value="Previous" name="_target1" />
			</div>
		</div>
	</form:form>
</div>

<idy:bs-iris-footer>
</idy:bs-iris-footer>